/*
 * @Autor: dingxiaolin
 * @Date: 2021-07-16 09:20:32
 * @LastEditors: dingxiaolin
 * @LastEditTime: 2021-07-18 21:34:36
 */
import { h } from 'vue';
import { enums } from '@/enums'
import store from '@/store'
export const getFormSchema = (): FormSchema => ({
    formItem: [
        {
            type: 'input',
            label: '参数名称',
            field: 'name',
            value: '',
            rules: true,
            props: {
                maxLength: 100
            },
        },
        {
            type: 'input',
            label: '唯一编码',
            field: 'code',
            value: '',
            rules: true,
            props: {
                maxLength: 50
            },
        },
        {
            type: 'radio-button',
            label: '系统参数',
            field: 'sysFlag',
            value: 'Y',
            rules: true,
            options: enums.sysFlagOptions
        },
        {
            type: 'select',
            label: '所属分类',
            field: 'groupCode',
            value: undefined,
            options: [],
            loading: true,
            rules: true,
            asyncOptions: async () => {
                const data = await store.dispatch('enums/getEnum', 'consts_type')
                return data.map((item) => ({
                    label: item.value,
                    value: item.code
                }))
            }
        },
        {
            type: 'input',
            label: '参数值',
            field: 'value',
            value: '',
            props: {
                maxLength: 10
            },
            rules: true,
        },
        {
            type: 'textarea',
            label: '备注',
            field: 'remark',
            value: '',
            props: {
                maxLength: 254,
                rows: 4
            },
            // rules: true
        },
    ]
})
